;; General configuration
(require 'org-install)
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)

;; List of all Agendas in use
(setq org-agenda-files (list "~/org/projects.org"
			     "~/org/life.org"))

(defun org-mode-is-intrusive ()
  ;; Keep change buffer shortcuts
  (local-unset-key [M-left])
  (local-unset-key [M-right])
  )
(add-hook 'org-mode-hook 'org-mode-is-intrusive)

(defun yas/org-very-safe-expand ()
  (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
(add-hook 'org-mode-hook
	  (lambda ()
	    (make-variable-buffer-local 'yas/trigger-key)
	    (setq yas/trigger-key [tab])
	    (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
	    (define-key yas/keymap [tab] 'yas/next-field)))

(setq org-replace-disputed-keys t)
